<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<link href="https://cdn.bootcss.com/font-awesome/5.7.2/css/all.min.css">
<link rel="stylesheet" th:href="@{/css/slidercaptcha.css}">
</head>
<style>
	.slidercaptcha {
		margin: 0 auto;
		width: 314px;
		height: 286px;
		border-radius: 4px;
		box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
		margin-top: 40px;
	}
	.slidercaptcha .card-body {
		padding: 1rem;
	}
	.slidercaptcha canvas:first-child {
		border-radius: 4px;
		border: 1px solid #e6e8eb;
	}
	.slidercaptcha.card .card-header {
		background-image: none;
		background-color: rgba(0, 0, 0, 0.03);
	}
	.refreshIcon {
		top: -54px;
	}
</style>

<body>
	<center>
		我和我的祖国 一刻也不能分割
	</center>
	<div class="container-fluid">
		<div class="form-row">
			<div class="col-12">
				<div class="slidercaptcha card">
					<div class="card-header">
						<span>请完成安全验证!</span>
					</div>
					<div class="card-body">
						<div id="captcha"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script th:src="@{/js/jquery.min.js}"></script>
	<script th:src="@{/js/bootstrap.bundle.js}"></script>
	<script th:src="@{/js/longbow.slidercaptcha.js}"></script>
	<script>
        var $captcha = $('#captcha').sliderCaptcha({
            loadingText: '正在加载中...',
            failedText: '再试一次',
            barText: '向右滑动填充拼图',
            repeatIcon: 'fa fa-redo',
            setSrc: function () {
                return 'http://127.0.0.1:mp/images/Pic' + Math.round(Math.random() * 136) + '.jpg';
            },
            onSuccess: function () {  //成功事件
               /* var handler = setTimeout(function () {
                    window.clearTimeout(handler);
                    $captcha.sliderCaptcha('reset');
                }, 500);*/
               console.log("验证成功")
            }
        });

       /* $('#captcha').sliderCaptcha({
 			width: 280,
            height: 150,
            sliderL: 42,
            sliderR: 9,
            offset: 5,
            loadingText: '正在加载中...',
            failedText: '再试一次',
            barText: '向右滑动填充拼图',
            repeatIcon: 'fa fa-redo',
            setSrc: function () {

            },
            onSuccess: function () {

            },
            onFail: function () {

            },
            onRefresh: function () {

            }
        });*/
       var j=0;
       for (var i=0;i<1;i++){
           $.ajax({
               type: "get",
               contentType : "application/json;charset=utf-8",
               url: "http://47.105.51.27:8080/get/{ \"[]\": { \"Moment\": {} } }",
               success : function(data){
                   j++;
				  console.log("执行成功,第",j, "次")
                 // console.log(data);
               }
           });
	   }
	</script>
</body>
</html>